package com.cell.foodie.back.admin.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

import com.cell.foodie.back.admin.dao.AdminMapper;
import com.cell.foodie.back.admin.entity.Admin;

/**
 * 后台登录服务接口实现
 * @author huhu
 *
 */
@Service("adminLoginService")
public class LoginServiceImpl implements LoginService {

  @Autowired
  AdminMapper adminMapper;
  @Override
  public Boolean login(Admin admin) {
    
    /*
     * 进行MD5加密
     *将用户名和密码一起加密 
     */
    String pwd = admin.getAdminName() + admin.getAdminPwd();
    String md5Pwd = DigestUtils.md5DigestAsHex(pwd.getBytes());
    admin.setAdminPwd(md5Pwd);
    return adminMapper.select(admin);

  }

}
